﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;

namespace OAWeb
{
    public partial class m_MeetingRecorderAdd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int uid = int.Parse(Session["UserID"].ToString());
            int mID = int.Parse(Request["mID"]);
            m_Meeting m = new m_Meeting();
            SqlDataReader dr =
                m.myDataReader("select count(id) from m_joiners where mid=" + mID + " and uID=" + uid + " and istype=2");
            if(dr.Read())
            {
                if(dr[0].ToString()=="0")
                {
                    Literal1.Text = "<script language=javascript>alert('您不是该会议的记录员！');</script>";
                    Literal2.Text = "<script language=javascript>window.close();</script>";
                }
            }
            SqlDataReader _dr = m.myDataReader("select mTitle from m_meetinginfo where mID=" + mID);
            if(_dr.Read())
            {
                lblMeetingTitle.Text = _dr[0].ToString();
            }
        }

        protected void btnSUb_Click(object sender, EventArgs e)
        {
            int uid = int.Parse(Session["UserID"].ToString());
            int mID = int.Parse(Request["mID"]);
            m_Meeting m = new m_Meeting();

            m.myExecNonQuery("insert into m_myRecord (meetingid,uid,recodercontent,isDone)values(" + mID + "," + uid +
                             ",'" + FCKeditor2.Value + "',1)");
            m.myExecNonQuery("update m_Joiners set isStatues=1 where mID=" + mID + " and uid=" + uid);
           
            Literal1.Text = "<script language=javascript>alert('添加成功！');</script>";
            Literal2.Text = "<script language=javascript>window.close();</script>";
        }
    }
}
